import QtQuick 1.1

Rectangle {
  id: faderRect

  property int transitionDuration: 300
  property double fadingOpacity: 0.7

  width: parent.width
  height: parent.height

  color: "black"
  opacity: 0

  Rectangle {
    id: keyCapturer

    MouseArea {
      id: mouseArea
      width: faderRect.width
      height: faderRect.height
      z: 200 // Make sure that this is on top.
    }
  }

  states: [
    State {
      name: ""
      PropertyChanges {
        target: faderRect
        opacity: 0
      }
    },
    State {
      name: "faded"
      PropertyChanges {
        target: faderRect
        opacity: fadingOpacity
      }
    }
  ]

  transitions: [
    Transition {
      from: ""
      to: "faded"
      SequentialAnimation {
        NumberAnimation { properties: "opacity"; easing.type: Easing.Linear; duration: transitionDuration }
      }
    },
    Transition {
      from: "faded"
      to: ""
      NumberAnimation { properties: "opacity"; easing.type: Easing.Linear; duration: transitionDuration }
    }
  ]
}
